//
//  GoodsListTableViewController.m
//  Assistant
//
//  Created by liaozhenming on 16/6/6.
//  Copyright © 2016年 liaozhenming. All rights reserved.
//

#import "GoodsListTableViewController.h"

#import "GoodsEditViewController.h"

@interface GoodsListTableViewController ()

@end

@implementation GoodsListTableViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.tableView.tableFooterView = [UIView new];
    UIBarButtonItem *rigthItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem: UIBarButtonSystemItemAdd target: self action: @selector(action_edit:)];
    self.navigationItem.rightBarButtonItem = rigthItem;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark - Private methods

- (void)action_edit:(UIBarButtonItem*)item {
    
    GoodsEditViewController *editViewController = [GoodsEditViewController kk_viewControllerFromStoryboard];
    [self kk_pushViewController: editViewController];
}

#pragma mark - Table view data source

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return 15;
}

- (UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    
    UITableViewCell *cell = [UITableViewCell kk_cellWithTableView: tableView];
    cell.textLabel.text = [NSString stringWithFormat: @"%@", @(indexPath.row + 1)];
    return cell;
}
@end
